#include<iostream>
#include<signal.h>
#include<unistd.h>

using namespace std;

int main()
{
    sigset_t set;
    sigemptyset(&set);
    sigaddset(&set,2);
    sigaddset(&set,40);
    if(-1==sigprocmask(SIG_SETMASK,&set,NULL))
    {
        perror("sigprocmask");
        exit(-1);
    }
    int count=5;
    while(count--)
    {
        cout<<"send 2 signal "<<endl;
        kill(getpid(),2);
        sleep(1);
    }
    count=5;
    while(count--)
    {
        cout<<"send 40 signal "<<endl;
        kill(getpid(),2);
        sleep(1);
    }
    
    return 0;
}